<?php
    class Model_DbTable_Users extends Zend_Db_Table
    {
        /*
         * table name
         */
        protected $_name = 'users';
        /*
         * blog user types
         */
        static $userTypes = array('member' => 'Member',
                                  'administrator' => 'Administrator');

        /*
         * __set
         *
         * Change input value for password and
         * user type automatically
         *
         * @param string $name
         * @param mixed $value
         */
        public function __set($name, $value) {
            switch ($name) {
            	case 'password':
            	   $value = md5($value);
            	break;

            	case 'user_type':
                   if (!array_key_exists($value, self::userTypes)) {
                       $value = 'member';
                   }
                break;
            }

            parent::__set($name, $value);
        }
    }
?>